import http from "@/utils/request";

const baseurl = "/glacier-hardware/host";
// const baseurl = "/host";

// 查询主机信息
export function getHost(params: any) {
    return http.request({
        url: baseurl + "/getHost",
        method: 'get',
        params: params
    })
}

// 新增主机
export function addOrUpHost(data: any) {
    return http.request({
        url: baseurl + "/addOrUpHost",
        method: 'post',
        data: data,
    })
}

// 删除主机
export function delHost(id: any) {
    return http.request({
        url: baseurl + "/delHost?id="+id,
        method: 'delete',
    })
}
// 查询所有企业名称
export function getCompanyName() {
    return http.request({
        url: baseurl + "/getCompanyName",
        method: 'get'
    })
}

// 查询所有仓库名称
export function getWarehouseName(companyId: any) {
    return http.request({
        url: baseurl + "/getWarehouseName?companyId="+companyId,
        method: 'get'
    })
}

// export function get
// export function addHost(hostAddDTO: any) {
//     return http.request({
//         url: baseurl + "/add",
//         method: 'post',
//         params: hostAddDTO
//     })
// }
export function deleHost(id: any) {
    return http.request({
        url: baseurl + "/deleteById",
        method: 'get',
        params: { id }
    })
}
export function startHost(id: any) {
    return http.request({
        url: baseurl + "/start",
        method: 'post',
        params: { id }
    })
}
export function stopHost(id: any) {
    return http.request({
        url: baseurl + "/stop",
        method: 'post',
        params: { id }
    })
}
export function findByIdHost(id: any) {
    return http.request({
        url: baseurl + "/findById",
        method: 'get',
        params: { id }
    })
}
export function findOneCompanyName(id: any) {
    return http.request({
        url: baseurl + "/findOneCompanyName",
        method: 'get',
        params: { id }
    })
}
export function updatehost(hostUpdateDTO: any) {
    return http.request({
        url: baseurl + "/update",
        method: 'post',
        data: hostUpdateDTO
    })
}
